﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;

namespace BasicCMS.Core.Filters
{
    /// <summary>
    /// 权限过滤
    /// </summary>
    public class AuthrizationFilter:FilterAttribute,IAuthorizationFilter
    {
        public void OnAuthorization(AuthorizationContext filterContext)
        {
            if (filterContext.RequestContext.RouteData.DataTokens["Admin"]!=null && filterContext.HttpContext.Session["UserName"] == null)
            {
                filterContext.HttpContext.Server.Transfer("~/Account/Logon");
                filterContext.HttpContext.Response.End();
            }
        }
    }
}